export const mindData = {
  id: 11408,
  noteName: "监控系统",
  level: 0,
  fraction: 100,
  score: "A",
  type: "维度",
  children: [
    {
      id: 11402,
      noteName: "1F",
      level: 1,
      fraction: 100,
      type: "维度",
      score: "B",
      direction: "left",
    },
    {
      id: 114022,
      noteName: "2F",
      level: 1,
      fraction: 100,
      type: "维度",
      score: "C",
      direction: "left",
    },
    {
      id: 1140233,
      noteName: "3F",
      type: "维度",
      level: 1,
      fraction: 100,
      score: "A",
      direction: "left",
    },
    {
      id: 114024,
      noteName: "4F",
      type: "维度",
      level: 1,
      fraction: 100,
      score: "A",
      direction: "left",
    },
    {
      id: 114502,
      noteName: "5F",
      type: "维度",
      level: 1,
      fraction: 100,
      score: "A",
      direction: "right",
    },
    {
      id: 116402,
      noteName: "6F",
      type: "维度",
      level: 1,
      fraction: 100,
      score: "B",
      direction: "right",
    },
    {
      id: 114802,
      noteName: "7F",
      type: "维度",
      level: 1,
      fraction: 100,
      score: "C",
      direction: "right",
    },
    {
      id: 114902,
      noteName: "8F",
      type: "维度",
      level: 1,
      fraction: 100,
      score: "B",
      direction: "right",
    },
  ],
};

const originData = [
  {
    unit: "ff5cb3c8d6d641b1af0e3af6db9dfb45|03011M",
    dimensionScore: "A",
    name: "1F",
    evaluationTarget: "xxx系统",
    equipmentName: "向家坝1F水轮发电机组",
  },
  {
    unit: "ff5cb3c8d6d641b1af0e3af6db9dfb45|03082M",
    dimensionScore: "C",
    name: "8F",
    evaluationTarget: "xxx系统",
    equipmentName: "向家坝8F水轮发电机组",
  },
];

function resetData(title, originData) {
  originData.sort((a, b) => parseInt(a.name) - parseInt(b.name));
  const returnList = [
    {
      id: 11408,
      noteName: title,
      level: 0,
      fraction: 100,
      score: "A",
      type: "维度",
      children: [],
    },
  ];
  returnList[0].children = originData.map((item,index) => {
    return  {
      id: index +100,
      noteName: item.name,
      level: 1,
      fraction: 100,
      score: item.dimensionScore,
      type: "维度",
      direction: index % 2 === 0 ? 'left' :'right'
    }
  });

  return returnList
}


export const mindData1 = resetData('监控系统',originData)
// console.log('mindData resetData',mindData);